package com.sichemxiang.config.exception;

/**
 * @Author xiangshizhen
 * @Date 2025/1/14
 */
public class BaseException extends RuntimeException{
    private static final long serialVersionUID = -3457046903820067621L;

    private String code;


    public BaseException(ErrorEnum errorEnum) {
        super(errorEnum.getMessage());
        this.code = errorEnum.getCode();
    }

    public BaseException(ErrorEnum errorEnum, Throwable throwable) {
        super(errorEnum.getMessage(), throwable);
        this.code = errorEnum.getCode();
    }

    public BaseException(ErrorEnum errorEnum, String message) {
        super(message);
        this.code = errorEnum.getCode();
    }

    public BaseException(ErrorEnum errorEnum, String message, Throwable throwable) {
        super(message, throwable);
        this.code = errorEnum.getCode();
    }

    public BaseException(String message, Throwable throwable) {
        super(message, throwable);
        this.code = ErrorEnum.SYSTEM_ERROR.getCode();
    }

    public BaseException(String code, String message) {
        super(message);
        this.code = code;
    }

    public BaseException(String code, String message, Throwable throwable) {
        super(message, throwable);
        this.code = code;
    }

    public BaseException(Throwable throwable) {
        super(throwable);
    }

    public String getCode() {
        return this.code;
    }

    public void setCode(String code) {
        this.code = code;
    }


}
